package cn.sofwin.day0328;

public class Test01 {
    private static void surfInternet(){
        synchronized (Test01.class){
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + " is learning..." + i);
                try {
                    Thread.sleep(20);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    static class Person implements Runnable{
        @Override
        public void run() {
            surfInternet();
        }
    }
    public static void main(String[] args) {
        Thread t1 = new Thread(new Person());
        Thread t2 = new Thread(new Person());

        t1.start();
        t2.start();
    }
}
